/*
DO FILE FOR REPLICATION FOR 
Local labor market effects of nuclear power plants

BY Duha T. Altindag, Reem El Cheikh Taha, Jennifer U. Jones, and R. Alan Seals, Jr., May 2025
*/

**"${path}clean_data/Final Panel.dta" includes all counties in the USA
**"${path}clean_data/Considered panel.dta" includes only the counties that constructed their first reactor between 1974 and 1978 which is our sample

clear all
set more off

global path "C:/Users/Reem/Desktop/stata files/"

********************Appendix A

*****Appendix A Figures
***Appendix Figures A1 and A2 are in ReplicationMain_Tables.do under table 1 codes

***Appendix Figure A3: Means Treated vs Control
use "${path}clean_data/Considered Panel.dta", clear
egen g=group(GEOFIPS  year)
bys g:gen plant_exists=construction_dummy+commercial_dummy
replace plant_exists=1 if plant_exists>=2
gen treat_year= year if plant_exists==1
bys GEOFIPS: egen first_treat=min(treat_year)
bys GEOFIPS: gen ry=.
bys GEOFIPS: replace ry=year-first_treat if treated==1
bys GEOFIPS: replace ry=year-1975 if treated==0
replace ry=-5 if ry<=-5 & ry!=. //5 years and before
replace ry=20 if ry>=20 & ry!=.  //20 years and after

preserve
label define label_ry -5 "5+ years before" 1 "1st Year" 20 "20+"
label values ry label_ry
collapse (mean) emp_rate log_wages_Rpercapita,by(treated ry)
twoway ///
    (connected emp_rate ry if treated ==1, lcolor(navy) lwidth(thick) mcolor(navy) msymbol(circle)) ///
    (connected emp_rate ry if treated ==0, lcolor(green) lpattern(dash) lwidth(thick) mcolor(green) msymbol(circle)) ///
    (connected log_wages_Rpercapita ry if treated ==1 , lcolor(maroon) lwidth(thin) mcolor(maroon) msymbol(circle) yaxis(2)) ///
    (connected log_wages_Rpercapita ry if treated ==0 , lcolor(orange) lpattern(dash) lwidth(thin) mcolor(orange) msymbol(circle) yaxis(2)) ///
    , ytitle("Employment Rate" "(Thick Lines)") ytitle(, margin(small)) ///
ytitle("Log Wages" "(Thin Lines)", axis(2)) ytitle(, margin(small) axis(2)) ///
xtitle(Time Relative to NPP Construction) xtitle(, margin(small)) xline(1) ///
xlabel(-5 1 5 10 15 20, labels valuelabel) legend(off)
graph export "${path}results/FigureA3.png", replace
restore


****Appendix Figures A4, A5, A6, A7 C&D ES
use "${path}clean_data/Considered Panel.dta", clear
bys GEOFIPS: egen d=min(year) if construction_dummy==1
bys GEOFIPS: egen D=mean(d)
bys GEOFIPS: egen c=min(year) if commercial_dummy==1
bys GEOFIPS: egen C=mean(c)
g dif=C-D
did_multiplegt_dyn emp_rate GEOFIPS year construction_dummy,controls(commercial_dummy) cluster(GEOFIPS) effects(20) placebo(5)
graph export "${path}results/FigureA4.png", replace
did_multiplegt_dyn emp_rate GEOFIPS year commercial_dummy,controls(construction_dummy) cluster(GEOFIPS) effects(20) placebo(5)
graph export "${path}results/FigureA5.png", replace
did_multiplegt_dyn log_wages_Rpercapita GEOFIPS year construction_dummy,controls(commercial_dummy) cluster(GEOFIPS) effects(20) placebo(5)
graph export "${path}results/FigureA6.png", replace
did_multiplegt_dyn log_wages_Rpercapita GEOFIPS year commercial_dummy,controls(construction_dummy) cluster(GEOFIPS) effects(20) placebo(5)
graph export "${path}results/FigureA7.png", replace



*****Appendix A Tables

***Appendix Table A1
infix card_number 1 resp_number 2-6 area_code 7-9 exchange 10-12 completed 17 ///
cover_sheet 18 adults 21 sex 22 batch_number 26-27 q5 34 q9 42 q10 43 q17 51 ///
q19 73 q21 75 q22 76 q23 77 ///
using "${path}clean_data/07819-0004-Data-card_image.txt", clear

g want_more_npps=.
replace want_more_npps=1 if q5==1
replace want_more_npps=0 if q5==2
ren want_more_npps general

g TMI=.
replace TMI=1 if q9==1
replace TMI=0 if q9==2

g more_accidents=.
replace more_accidents=1 if q10==2
replace more_accidents=0 if q10==1

g npp_near_you=.
replace npp_near_you=1 if q17==1
replace npp_near_you=0 if q17==2

g republican=.
replace republican=1 if q19==1
replace republican=0 if q19==2 | q19==3

g hs=.
replace hs=1 if q21==2 | q21==3
replace hs=0 if q21==1 | q21==4

g college=.
replace college=1 if q21==4
replace college=0 if q21==1 | q21==2 | q21==3

g age_3044=.
replace age_3044=1 if q22==2
replace age_3044=0 if q22==1 | q22==3 | q22==4

g age_4560=.
replace age_4560=1 if q22==3
replace age_4560=0 if q22==1 | q22==2 | q22==4 

g age_60plus=.
replace age_60plus=1 if q22==4
replace age_60plus=0 if q22==1 | q22==2 | q22==3

g nonwhite=.
replace nonwhite=1 if q23==2 | q23==3 
replace nonwhite=0 if q23==1

g female=.
replace female=1 if sex==2
replace female=0 if sex==1

local x "female nonwhite age_3044 age_4560 age_60plus adults hs college republican"
eststo clear
eststo: areg TMI npp_near_you `x',absorb(area_code) r
eststo: areg general npp_near_you `x',absorb(area_code) r
eststo: areg more_accidents npp_near_you `x',absorb(area_code) r
esttab using "${path}results/tableA1.csv",b(%9.3f) se(%9.3f) star(* 0.10 ** 0.05 *** 0.01) nogaps replace

***Appendix Table A2: All treated included
use "${path}clean_data/Final Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year if county_considered==1, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year if county_considered==1, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year if county_considered==1, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA2.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label replace ///
keep(construction_dummy commercial_dummy)


***Appendix Table A3: excluding controls with another construction phase
use "${path}clean_data/Considered Panel.dta", clear
drop if GEOFIPS==45021 | GEOFIPS==37183 | GEOFIPS==13033 | GEOFIPS==29027
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA3.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label replace ///
keep(construction_dummy commercial_dummy)


******Appendix Table A4: Additional Controls & Trends
*****Panel A
use "${path}clean_data/Considered Panel.dta", clear
egen county_id=group(GEOFIPS)
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year c.year#i.county_id, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year c.year#i.county_id, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year c.year#i.county_id, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg emp_rate construction_dummy commercial_dummy i.year c.year#c.year#i.county_id, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year c.year#c.year#i.county_id, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year c.year#c.year#i.county_id, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA4.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label replace ///
keep(construction_dummy commercial_dummy)

******Panel B
use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"

local x "percentage_black percentage_age65plus percentage_female"
local z "foreign1960 sch121960 med_rent1960 owner_occ1960 med_fam_income1960" 
eststo clear
foreach v of varlist emp_rate log_wages_Rpercapita wages_Rpercapita {
eststo: reghdfe `v' construction_dummy commercial_dummy `x' c.(`z')#c.year, absorb(GEOFIPS year) cluster(GEOFIPS)
}
foreach v of varlist emp_rate log_wages_Rpercapita wages_Rpercapita {
eststo: reghdfe `v' construction_dummy commercial_dummy `x' c.(`z')#c.year#c.year, absorb(GEOFIPS year) cluster(GEOFIPS)
}
esttab using "${path}results/tableA4.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy)

****Panel C
use "${path}clean_data/Considered Panel.dta", clear
egen state_year= group(state_fips year)
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.GEOFIPS, a(state_year) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.GEOFIPS, a(state_year) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.GEOFIPS, a(state_year) cluster(GEOFIPS)
esttab using "${path}results/tableA4.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy)

****Panel D
use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
label variable other_utility_exists "Other Utility Plants (=1 if exists)"
label variable manuf_estab "No. Manuf. Establishments"
label variable pop_change "Pop. Change (from t-1)"
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy other_utility_exists manuf_estab pop_change i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy other_utility_exists manuf_estab pop_change i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy other_utility_exists manuf_estab pop_change i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA4.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy other_utility_exists manuf_estab pop_change)



***Appendix Table A5: excluding observations post-TMI (1979), post-Chernobyl (1986), and post-Fukushima (2011)

use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
drop if year>2011
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA5.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label replace ///
keep(construction_dummy commercial_dummy)

use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
drop if year>1986
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA5.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy)

use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
drop if year>1979
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA5.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy)

*****Appendix Table A6: Number of Reactors
use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
gen construction_dummy1=0
gen construction_dummy2=0
gen construction_dummy3=0
gen commercial_dummy1=0
gen commercial_dummy2=0
gen commercial_dummy3=0

*1071
replace construction_dummy1=1 if year>=1974 & year<=1987 & GEOFIPS==1071
replace construction_dummy2=1 if year>=1974 & year<=1987 & GEOFIPS==1071

*4013
replace construction_dummy1=1 if year>=1976 & year<=1984 & GEOFIPS==4013
replace construction_dummy2=1 if year>=1976 & year<=1985 & GEOFIPS==4013
replace construction_dummy3=1 if year>=1976 & year<=1986 & GEOFIPS==4013
replace commercial_dummy1=1 if year>=1985 & year<=2019 & GEOFIPS==4013
replace commercial_dummy2=1 if year>=1986 & year<=2019 & GEOFIPS==4013
replace commercial_dummy3=1 if year>=1987 & year<=2019 & GEOFIPS==4013

*13033
replace construction_dummy1=1 if year>=1974 & year<=1986 & GEOFIPS==13033
replace construction_dummy2=1 if year>=1974 & year<=1988 & GEOFIPS==13033
replace construction_dummy3=1 if year>=2012 & year<=2019 & GEOFIPS==13033
replace commercial_dummy1=1 if year>=1987 & year<=2019 & GEOFIPS==13033
replace commercial_dummy2=1 if year>=1989 & year<=2019 & GEOFIPS==13033

*17039
replace construction_dummy1=1 if year>=1976 & year<=1982 & GEOFIPS==17039
replace construction_dummy2=1 if year>=1976 & year<=1986 & GEOFIPS==17039
replace commercial_dummy1=1 if year>=1987 & year<=2019 & GEOFIPS==17039

*17141
replace construction_dummy1=1 if year>=1975 & year<=1984 & GEOFIPS==17141
replace construction_dummy2=1 if year>=1975 & year<=1986 & GEOFIPS==17141
replace commercial_dummy1=1 if year>=1985 & year<=2019 & GEOFIPS==17141
replace commercial_dummy2=1 if year>=1987 & year<=2019 & GEOFIPS==17141

*17197
replace construction_dummy1=1 if year>=1975 & year<=1986 & GEOFIPS==17197
replace construction_dummy2=1 if year>=1975 & year<=1987 & GEOFIPS==17197
replace commercial_dummy1=1 if year>=1988 & year<=2019 & GEOFIPS==17197
replace commercial_dummy2=1 if year>=1988 & year<=2019 & GEOFIPS==17197

*18077
replace construction_dummy1=1 if year>=1978 & year<=1984 & GEOFIPS==18077
replace construction_dummy2=1 if year>=1978 & year<=1984 & GEOFIPS==18077

*18127
replace construction_dummy1=construction_dummy if  GEOFIPS==18127

*20031
replace construction_dummy1=construction_dummy if  GEOFIPS==20031
replace commercial_dummy1=commercial_dummy if  GEOFIPS==20031

*22089
replace construction_dummy1=construction_dummy if  GEOFIPS==22089
replace commercial_dummy1=commercial_dummy if  GEOFIPS==22089

*28141
replace construction_dummy1=1 if year>=1978 & year<=1983 & GEOFIPS==28141
replace construction_dummy2=1 if year>=1978 & year<=1983 & GEOFIPS==28141

*29027
replace construction_dummy1=1 if year>=1976 & year<=1983 & GEOFIPS==29027
replace construction_dummy2=1 if year>=1976 & year<=2015 & GEOFIPS==29027
replace construction_dummy3=1 if year>=2015 & year<=2015 & GEOFIPS==29027
replace commercial_dummy1=1 if year>=1984 & year<=2019 & GEOFIPS==29027

*33015
replace construction_dummy1=1 if year>=1976 & year<=1988 & GEOFIPS==33015
replace construction_dummy2=1 if year>=1976 & year<=1989 & GEOFIPS==33015
replace commercial_dummy2=1 if year>=1990 & year<=2019 & GEOFIPS==33015

*37183
replace construction_dummy1=1 if year>=1978 & year<=1980 & GEOFIPS==37183
replace construction_dummy2=1 if year>=1978 & year<=1980 & GEOFIPS==37183
replace construction_dummy3=1 if year>=1978 & year<=1982 & GEOFIPS==37183
replace construction_dummy3=1 if year>=1978 & year<=1985 & GEOFIPS==37183
replace construction_dummy3=1 if year>=2013 & year<=2013 & GEOFIPS==37183
replace commercial_dummy3=1 if year>=1987 & year<=2019 & GEOFIPS==37183

*39085
replace construction_dummy1=1 if year>=1977 & year<=1985 & GEOFIPS==39085
replace construction_dummy2=1 if year>=1977 & year<=1993 & GEOFIPS==39085
replace commercial_dummy2=1 if year>=1986 & year<=2019 & GEOFIPS==39085

*42091
replace construction_dummy1=1 if year>=1974 & year<=1984 & GEOFIPS==42091
replace construction_dummy2=1 if year>=1974 & year<=1984 & GEOFIPS==42091
replace commercial_dummy1=1 if year>=1985 & year<=2019 & GEOFIPS==42091
replace commercial_dummy1=1 if year>=1989 & year<=2019 & GEOFIPS==42091

*45021
replace construction_dummy1=1 if year>=1977 & year<=1981 & GEOFIPS==45021
replace construction_dummy2=1 if year>=1977 & year<=1981 & GEOFIPS==45021
replace construction_dummy3=1 if year>=1977 & year<=1982 & GEOFIPS==45021
replace construction_dummy3=1 if year>=2016 & year<=2017 & GEOFIPS==45021

*45091
replace construction_dummy1=1 if year>=1975 & year<=1984 & GEOFIPS==45091
replace construction_dummy2=1 if year>=1975 & year<=1985 & GEOFIPS==45091
replace commercial_dummy1=1 if year>=1985 & year<=2019 & GEOFIPS==45091
replace commercial_dummy2=1 if year>=1986 & year<=2019 & GEOFIPS==45091

*47073
replace construction_dummy1=1 if year>=1978 & year<=1981 & GEOFIPS==47073
replace construction_dummy2=1 if year>=1978 & year<=1981 & GEOFIPS==47073

*47169
replace construction_dummy1=1 if year>=1977 & year<=1981 & GEOFIPS==47169
replace construction_dummy2=1 if year>=1977 & year<=1981 & GEOFIPS==47169
replace construction_dummy3=1 if year>=1977 & year<=1983 & GEOFIPS==47169

*48321
replace construction_dummy1=1 if year>=1975 & year<=1987 & GEOFIPS==48321
replace construction_dummy2=1 if year>=1975 & year<=1988 & GEOFIPS==48321

replace commercial_dummy1=1 if year>=1988 & year<=2019 & GEOFIPS==48321
replace commercial_dummy2=1 if year>=1989 & year<=2019 & GEOFIPS==48321

*48425
replace construction_dummy1=1 if year>=1974 & year<=1989 & GEOFIPS==48425
replace construction_dummy2=1 if year>=1974 & year<=1992 & GEOFIPS==48425

replace commercial_dummy1=1 if year>=1990 & year<=2019 & GEOFIPS==48425
replace commercial_dummy2=1 if year>=1993 & year<=2019 & GEOFIPS==48425

*53027
replace construction_dummy1=1 if year>=1978 & year<=1994 & GEOFIPS==53027
replace construction_dummy2=1 if year>=1978 & year<=1981 & GEOFIPS==53027

label variable construction_dummy1 "Construction of 1st reactor"
label variable construction_dummy2 "Construction of 2nd reactor"
label variable construction_dummy3 "Construction of 3rd+ reactor"
label variable commercial_dummy1 "Comm. Op. of 1st reactor"
label variable commercial_dummy2 "Comm. Op. of 2nd reactor"
label variable commercial_dummy3 "Comm. Op. of 3rd+ reactor"

eststo clear
eststo: areg emp_rate construction_dummy1 construction_dummy2 construction_dummy3  commercial_dummy1 commercial_dummy2 commercial_dummy3  i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy1 construction_dummy2 construction_dummy3  commercial_dummy1 commercial_dummy2 commercial_dummy3  i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy1 construction_dummy2 construction_dummy3  commercial_dummy1 commercial_dummy2 commercial_dummy3  i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA6.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) keep (construction_dummy1 construction_dummy2 construction_dummy3  commercial_dummy1 commercial_dummy2 commercial_dummy3) nogaps label replace 



*******Appendix Table A7: Falsification Test
use "${path}clean_data/falsification test.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA7.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label replace ///
keep(construction_dummy commercial_dummy)


******Appendix Table A8: exclude some control counties
*panel A
use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
keep if treated==1 | GEOFIPS==1021 |GEOFIPS==6037|GEOFIPS==6065|GEOFIPS==6071|GEOFIPS==6099|GEOFIPS==12095|GEOFIPS==23027|GEOFIPS==26147|GEOFIPS==36039|GEOFIPS==37129|GEOFIPS==40131|GEOFIPS==42071|GEOFIPS==44009|GEOFIPS==48015|GEOFIPS==55033
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA8.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label replace ///
keep(construction_dummy commercial_dummy)

**panel B: dropping the ones that mentioned cost as a reason for cancellation
use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
***left with 15 control county out of the 34
keep if treated==1 | GEOFIPS==1021 |GEOFIPS==6037|GEOFIPS==6099|GEOFIPS==19099|GEOFIPS==24017|GEOFIPS==36011|GEOFIPS==36039| GEOFIPS==37129|GEOFIPS==40131|GEOFIPS==41021|GEOFIPS==42071|GEOFIPS==44009|GEOFIPS==48015|GEOFIPS==55033|GEOFIPS==55117
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA8.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy)

**panel C
use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
****8 control counties could not find reasons for cancelleation dropped
****16 control counties dropped since cancelled due to financial constraint & chnge in forecast
****so left with 10 control county out of the 34
keep if treated==1 | GEOFIPS==1021 |GEOFIPS==6037|GEOFIPS==6099| GEOFIPS==36039| GEOFIPS==37129|GEOFIPS==40131|GEOFIPS==42071|GEOFIPS==44009|GEOFIPS==48015|GEOFIPS==55033
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA8.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy)

**panel D
use "${path}clean_data/Considered Panel.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
keep if treated==1
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(GEOFIPS) cluster(GEOFIPS)
esttab using "${path}results/tableA8.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy)


******Appendix Table A9: CZ
use "${path}clean_data/Considered Panel CZ.dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable emp_rate "Emp.to Pop. Ratio"
label variable log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
eststo clear
eststo: areg emp_rate construction_dummy commercial_dummy i.year, a(czone) cluster(czone)
eststo: areg log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(czone) cluster(czone)
eststo: areg wages_Rpercapita construction_dummy commercial_dummy i.year, a(czone) cluster(czone)
esttab using "${path}results/tableA9.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label replace ///
keep(construction_dummy commercial_dummy)


***********************APPENDIX B

*****Appendix B Figures

***Appendix Figure B1, B2, B3, & B4
**manually add the arrows and labels
*fig B1
use "${path}clean_data/Final SC panel (Emp).dta", clear
twoway (line scm_emp_rate year if geo == "13033", lcolor(black) lpattern(solid)) ///
       (line scm_emp_rate year if geo == "13033_c", lcolor(black) lpattern(dash)), ///
       legend(order(1 "Burke GA" 2 "Synthetic Burke")) ///
       xtitle("Year") ytitle("The Employment to Population Ratio") 
graph export "${path}results/FigureB1.png", replace

*fig B2
use "${path}clean_data/Final SC panel (Wages).dta", clear
twoway (line scm_log_wages_Rpercapita year if geo == "13033", lcolor(black) lpattern(solid)) ///
       (line scm_log_wages_Rpercapita year if geo == "13033_c", lcolor(black) lpattern(dash)), ///
       legend(order(1 "Burke GA" 2 "Synthetic Burke")) ///
       xtitle("Year") ytitle("Log of Per Capita Wages & Salaries")
graph export "${path}results/FigureB2.png", replace

***fig B3
use "${path}clean_data/Final SC panel (Emp).dta", clear
twoway (line scm_emp_rate year if geo == "28141", lcolor(black) lpattern(solid)) ///
       (line scm_emp_rate year if geo == "28141_c", lcolor(black) lpattern(dash)), ///
       legend(order(1 "Tishomingo MS" 2 "Synthetic Tishomingo")) ///
       xtitle("Year") ytitle("Employment to Population Ratio") 
graph export "${path}results/FigureB3.png", replace

***fig B4	
use "${path}clean_data/Final SC panel (Wages).dta", clear
twoway (line scm_emp_rate year if geo == "45021", lcolor(black) lpattern(solid)) ///
       (line scm_emp_rate year if geo == "45021_c", lcolor(black) lpattern(dash)), ///
       legend(order(1 "Cherokee SC" 2 "Synthetic Cherokee")) ///
       xtitle("Year") ytitle("Employment to Population Ratio") 
graph export "${path}results/FigureB4.png", replace

***Appendix Figures B5, B6, B7, & B8
**figures B5, B6
foreach j in 1021  1047 1051 6037 6045 6065 6071 6097 6099 12095 17015 19099 22051 23027 24017 26147 26157 36011 36039 37059 37129 39043 40131 41021 42071 44009 45003 47145 48015 48351 48469  53057 55033 55117{
cd "${path}temp_data"
clear 
use "${path}clean_data\Leave one out\Final SC panel (Emp)_removing`j'.dta", clear
areg scm_emp_rate  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave  construction_dummy  commercial_dummy using emp_removing`j'
}

***Plot
use "${path}temp_data/emp_removing1021.dta", clear
gen t=1
save "${path}temp_data/emp_removing1021.dta", replace

use "${path}temp_data/emp_removing1047.dta", clear
gen t=2
save "${path}temp_data/emp_removing1047.dta", replace

use "${path}temp_data/emp_removing1051.dta", clear
gen t=3
save "${path}temp_data/emp_removing1051.dta", replace

use "${path}temp_data/emp_removing6037.dta", clear
gen t=4
save "${path}temp_data/emp_removing6037.dta", replace

use "${path}temp_data/emp_removing6045.dta", clear
gen t=5
save "${path}temp_data/emp_removing6045.dta", replace

use "${path}temp_data/emp_removing6065.dta", clear
gen t=6
save "${path}temp_data/emp_removing6065.dta", replace

use "${path}temp_data/emp_removing6071.dta", clear
gen t=7
save "${path}temp_data/emp_removing6071.dta", replace

use "${path}temp_data/emp_removing6097.dta", clear
gen t=8
save "${path}temp_data/emp_removing6097.dta", replace

use "${path}temp_data/emp_removing6099.dta", clear
gen t=9
save "${path}temp_data/emp_removing6099.dta", replace

use "${path}temp_data/emp_removing12095.dta", clear
gen t=10
save "${path}temp_data/emp_removing12095.dta", replace

use "${path}temp_data/emp_removing17015.dta", clear
gen t=11
save "${path}temp_data/emp_removing17015.dta", replace

use "${path}temp_data/emp_removing19099.dta", clear
gen t=12
save "${path}temp_data/emp_removing19099.dta", replace

use "${path}temp_data/emp_removing22051.dta", clear
gen t=13
save "${path}temp_data/emp_removing22051.dta", replace

use "${path}temp_data/emp_removing23027.dta", clear
gen t=14
save "${path}temp_data/emp_removing23027.dta", replace

use "${path}temp_data/emp_removing24017.dta", clear
gen t=15
save "${path}temp_data/emp_removing24017.dta", replace

use "${path}temp_data/emp_removing26147.dta", clear
gen t=16
save "${path}temp_data/emp_removing26147.dta", replace

use "${path}temp_data/emp_removing26157.dta", clear
gen t=17
save "${path}temp_data/emp_removing26157.dta", replace

use "${path}temp_data/emp_removing36011.dta", clear
gen t=18
save "${path}temp_data/emp_removing36011.dta", replace

use "${path}temp_data/emp_removing36039.dta", clear
gen t=19
save "${path}temp_data/emp_removing36039.dta", replace

use "${path}temp_data/emp_removing37059.dta", clear
gen t=20
save "${path}temp_data/emp_removing37059.dta", replace

use "${path}temp_data/emp_removing37129.dta", clear
gen t=21
save "${path}temp_data/emp_removing37129.dta", replace

use "${path}temp_data/emp_removing39043.dta", clear
gen t=22
save "${path}temp_data/emp_removing39043.dta", replace

use "${path}temp_data/emp_removing40131.dta", clear
gen t=23
save "${path}temp_data/emp_removing40131.dta", replace

use "${path}temp_data/emp_removing41021.dta", clear
gen t=24
save "${path}temp_data/emp_removing41021.dta", replace

use "${path}temp_data/emp_removing42071.dta", clear
gen t=25
save "${path}temp_data/emp_removing42071.dta", replace

use "${path}temp_data/emp_removing44009.dta", clear
gen t=26
save "${path}temp_data/emp_removing44009.dta", replace

use "${path}temp_data/emp_removing45003.dta", clear
gen t=27
save "${path}temp_data/emp_removing45003.dta", replace

use "${path}temp_data/emp_removing47145.dta", clear
gen t=28
save "${path}temp_data/emp_removing47145.dta", replace

use "${path}temp_data/emp_removing48015.dta", clear
gen t=29
save "${path}temp_data/emp_removing48015.dta", replace

use "${path}temp_data/emp_removing48351.dta", clear
gen t=30
save "${path}temp_data/emp_removing48351.dta", replace

use "${path}temp_data/emp_removing48469.dta", clear
gen t=31
save "${path}temp_data/emp_removing48469.dta", replace

use "${path}temp_data/emp_removing53057.dta", clear
gen t=32
save "${path}temp_data/emp_removing53057.dta", replace

use "${path}temp_data/emp_removing55033.dta", clear
gen t=33
save "${path}temp_data/emp_removing55033.dta", replace

use "${path}temp_data/emp_removing55117.dta", clear
gen t=34
save "${path}temp_data/emp_removing55117.dta", replace

use "${path}temp_data/emp_removing1021.dta", clear
foreach j in   1047 1051 6037 6045 6065 6071 6097 6099 12095 17015 19099 22051 23027 24017 26147 26157 36011 36039 37059 37129 39043 40131 41021 42071 44009 45003 47145 48015 48351 48469  53057 55033 55117{
append using "${path}temp_data/emp_removing`j'.dta"
}
g ub=coef+1.96*stderr
g lb=coef-1.96*stderr
twoway (scatter coef t if var=="construction_dummy") (rcap ub lb t if var=="construction_dummy"), xtitle("") xlabel(, nolabels) legend(off) 
graph export "${path}results/FigureB5.png", replace
twoway (scatter coef t if var=="commercial_dummy") (rcap ub lb t if var=="commercial_dummy"), xtitle("") xlabel(, nolabels) legend(off) 
graph export "${path}results/FigureB6.png", replace

*****figures B7, B8
foreach j in 1021  1047 1051 6037 6045 6065 6071 6097 6099 12095 17015 19099 22051 23027 24017 26147 26157 36011 36039 37059 37129 39043 40131 41021 42071 44009 45003 47145 48015 48351 48469  53057 55033 55117{
cd "${path}temp_data"
clear 
use"${path}clean_data\Leave one out\Final SC panel (Wages)_removing`j'.dta", clear
areg scm_log_wages_Rpercapita  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave  construction_dummy  commercial_dummy using wages_removing`j'
}

***Plot
use "${path}temp_data/wages_removing1021.dta", clear
gen t=1
save "${path}temp_data/wages_removing1021.dta", replace

use "${path}temp_data/wages_removing1047.dta", clear
gen t=2
save "${path}temp_data/wages_removing1047.dta", replace

use "${path}temp_data/wages_removing1051.dta", clear
gen t=3
save "${path}temp_data/wages_removing1051.dta", replace

use "${path}temp_data/wages_removing6037.dta", clear
gen t=4
save "${path}temp_data/wages_removing6037.dta", replace

use "${path}temp_data/wages_removing6045.dta", clear
gen t=5
save "${path}temp_data/wages_removing6045.dta", replace

use "${path}temp_data/wages_removing6065.dta", clear
gen t=6
save "${path}temp_data/wages_removing6065.dta", replace

use "${path}temp_data/wages_removing6071.dta", clear
gen t=7
save "${path}temp_data/wages_removing6071.dta", replace

use "${path}temp_data/wages_removing6097.dta", clear
gen t=8
save "${path}temp_data/wages_removing6097.dta", replace

use "${path}temp_data/wages_removing6099.dta", clear
gen t=9
save "${path}temp_data/wages_removing6099.dta", replace

use "${path}temp_data/wages_removing12095.dta", clear
gen t=10
save "${path}temp_data/wages_removing12095.dta", replace

use "${path}temp_data/wages_removing17015.dta", clear
gen t=11
save "${path}temp_data/wages_removing17015.dta", replace

use "${path}temp_data/wages_removing19099.dta", clear
gen t=12
save "${path}temp_data/wages_removing19099.dta", replace

use "${path}temp_data/wages_removing22051.dta", clear
gen t=13
save "${path}temp_data/wages_removing22051.dta", replace

use "${path}temp_data/wages_removing23027.dta", clear
gen t=14
save "${path}temp_data/wages_removing23027.dta", replace

use "${path}temp_data/wages_removing24017.dta", clear
gen t=15
save "${path}temp_data/wages_removing24017.dta", replace

use "${path}temp_data/wages_removing26147.dta", clear
gen t=16
save "${path}temp_data/wages_removing26147.dta", replace

use "${path}temp_data/wages_removing26157.dta", clear
gen t=17
save "${path}temp_data/wages_removing26157.dta", replace

use "${path}temp_data/wages_removing36011.dta", clear
gen t=18
save "${path}temp_data/wages_removing36011.dta", replace

use "${path}temp_data/wages_removing36039.dta", clear
gen t=19
save "${path}temp_data/wages_removing36039.dta", replace

use "${path}temp_data/wages_removing37059.dta", clear
gen t=20
save "${path}temp_data/wages_removing37059.dta", replace

use "${path}temp_data/wages_removing37129.dta", clear
gen t=21
save "${path}temp_data/wages_removing37129.dta", replace

use "${path}temp_data/wages_removing39043.dta", clear
gen t=22
save "${path}temp_data/wages_removing39043.dta", replace

use "${path}temp_data/wages_removing40131.dta", clear
gen t=23
save "${path}temp_data/wages_removing40131.dta", replace

use "${path}temp_data/wages_removing41021.dta", clear
gen t=24
save "${path}temp_data/wages_removing41021.dta", replace

use "${path}temp_data/wages_removing42071.dta", clear
gen t=25
save "${path}temp_data/wages_removing42071.dta", replace

use "${path}temp_data/wages_removing44009.dta", clear
gen t=26
save "${path}temp_data/wages_removing44009.dta", replace

use "${path}temp_data/wages_removing45003.dta", clear
gen t=27
save "${path}temp_data/wages_removing45003.dta", replace

use "${path}temp_data/wages_removing47145.dta", clear
gen t=28
save "${path}temp_data/wages_removing47145.dta", replace

use "${path}temp_data/wages_removing48015.dta", clear
gen t=29
save "${path}temp_data/wages_removing48015.dta", replace

use "${path}temp_data/wages_removing48351.dta", clear
gen t=30
save "${path}temp_data/wages_removing48351.dta", replace

use "${path}temp_data/wages_removing48469.dta", clear
gen t=31
save "${path}temp_data/wages_removing48469.dta", replace

use "${path}temp_data/wages_removing53057.dta", clear
gen t=32
save "${path}temp_data/wages_removing53057.dta", replace

use "${path}temp_data/wages_removing55033.dta", clear
gen t=33
save "${path}temp_data/wages_removing55033.dta", replace

use "${path}temp_data/wages_removing55117.dta", clear
gen t=34
save "${path}temp_data/wages_removing55117.dta", replace

use "${path}temp_data/wages_removing1021.dta", clear
foreach j in   1047 1051 6037 6045 6065 6071 6097 6099 12095 17015 19099 22051 23027 24017 26147 26157 36011 36039 37059 37129 39043 40131 41021 42071 44009 45003 47145 48015 48351 48469  53057 55033 55117{
append using "${path}temp_data/wages_removing`j'.dta"
}

g ub=coef+1.96*stderr
g lb=coef-1.96*stderr
twoway (scatter coef t if var=="construction_dummy") (rcap ub lb t if var=="construction_dummy") , xtitle("") xlabel(, nolabels) legend(off) 
graph export "${path}results/FigureB7.png", replace
twoway (scatter coef t if var=="commercial_dummy") (rcap ub lb t if var=="commercial_dummy"), xtitle("") xlabel(, nolabels) legend(off) 
graph export "${path}results/FigureB8.png", replace

****Appendix Figures B9, B10, B11, & B12
***Figures B9, B10
cd "${path}temp_data"
***Treated74
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 74(Emp).dta", clear
areg scm_emp_rate  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave  construction_dummy  commercial_dummy using emp74 
***treated75
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 75(Emp).dta", clear
areg scm_emp_rate  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using emp75 
***treated76
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 76(Emp).dta", clear
areg scm_emp_rate  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using emp76
***treated77
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 77(Emp).dta", clear
areg scm_emp_rate  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using emp77
***treated78
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 78(Emp).dta", clear
areg scm_emp_rate  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using emp78

***Plot
foreach i in 74 75 76 77 78 {
use "${path}temp_data/emp`i'.dta", clear
gen t=19`i'
save "${path}temp_data/emp`i'.dta", replace
}
use "${path}temp_data/emp74.dta", clear
append using "${path}temp_data/emp75.dta" "${path}temp_data/emp76.dta" "${path}temp_data/emp77.dta" "${path}temp_data/emp78.dta"
g ub=coef+1.96*stderr
g lb=coef-1.96*stderr
twoway (scatter coef t if var=="construction_dummy") (rcap ub lb t if var=="construction_dummy"), xtitle("Year") legend(off)
graph export "${path}results/FigureB9.png", replace
twoway (scatter coef t if var=="commercial_dummy") (rcap ub lb t if var=="commercial_dummy"), xtitle("Year") legend(off)
graph export "${path}results/FigureB10.png", replace

******Figures B11, B12
**treated74
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 74(Wages).dta", clear
areg scm_log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using wages74
**treated75
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 75(Wages).dta", clear
areg scm_log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using wages75
**treated76
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 76(Wages).dta", clear
areg scm_log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using wages76
**treated77
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 77(Wages).dta", clear
areg scm_log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using wages77
**treated78
clear
use "${path}clean_data/falsification test_Donor treated/Final SC panel 78(Wages).dta", clear
areg scm_log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
regsave construction_dummy  commercial_dummy using wages78

***Plot
foreach i in 74 75 76 77 78 {
use "${path}temp_data/wages`i'.dta", clear
gen t=19`i'
save "${path}temp_data/wages`i'.dta", replace
}
use "${path}temp_data/wages74.dta", clear
append using "${path}temp_data/wages75.dta" "${path}temp_data/wages76.dta" "${path}temp_data/wages77.dta" "${path}temp_data/wages78.dta"
g ub=coef+1.96*stderr
g lb=coef-1.96*stderr
twoway (scatter coef t if var=="construction_dummy") (rcap ub lb t if var=="construction_dummy") , xtitle("Year") legend(off)
graph export "${path}results/FigureB11.png", replace
twoway (scatter coef t if var=="commercial_dummy") (rcap ub lb t if var=="commercial_dummy"), xtitle("Year") legend(off)
graph export "${path}results/FigureB12.png", replace


***********************Appendix B Tables

***Appendix Table B1 & B2
*Appendix table B1
*first 3 columns from Table 3
use "${path}clean_data/Final Panel.dta", clear
gen restUS=0 
replace restUS=1 if treated==0 //include control group
replace restUS=1 if treated==. //include all other counties that did not consider constructing a plant
drop if first_construction_start<1974 // we only included counties that started construction in 1974 to calculate synthetic control so we can have enough pretreatment period (at least 5 years)

***drop counties whose status is future i.e didnt start construction yet
drop if GEOFIPS==6019
drop if GEOFIPS==16019
drop if GEOFIPS==16075
drop if GEOFIPS==47105
drop if GEOFIPS==49015
**drop counties that couldn't produce a synthetic control
drop if GEOFIPS==22125
drop if GEOFIPS==28021
***drop counties that built their first plant after 1978
drop if GEOFIPS==12075

*label
label variable emp_rate "Emp. to Pop. Ratio"
label variable wages_Rpercapita "Per Capita Wages & Salaries"
label variable personal_income_Rpercapita "Total Personal Inc."

//post table 3 and add one more column
local y "emp_rate wages_Rpercapita personal_income_Rpercapita"
eststo treated: estpost sum `y' if year<=1973 & treated==1
eststo control: estpost sum `y' if year<=1973 & treated==0
eststo rest: estpost sum `y' if year<=1973 & restUS==1
esttab treated control rest using "${path}results/tableB1.csv", ///
    cells("mean(fmt(3))") ///
    mtitles("Treated" "Control" "Rest of the US")label replace

*last column
use "${path}clean_data/Final SC panel (Emp).dta", clear
local y "scm_emp_rate scm_wages_Rpercapita scm_personal_income_Rpercapita "
eststo control: estpost sum `y' if year<=1973 & matched_treated==0
esttab control using "${path}results/tableB1.csv", ///
    cells("mean(fmt(3))") ///
    mtitles("Synthetic Control") label append

local y "scm_emp_rate scm_wages_Rpercapita scm_personal_income_Rpercapita "
eststo treated: estpost sum `y' if year<=1973 & matched_treated==1
eststo control: estpost sum `y' if year<=1973 & matched_treated==0
eststo diff: estpost ttest `y' if year<=1973, by(matched_treated) unequal
esttab diff 

*Appendix Table B2
use "${path}clean_data/Final Panel.dta", clear
gen restUS=0 
replace restUS=1 if treated==0 //include control group
replace restUS=1 if treated==. //include all other counties that did not consider constructing a plant
drop if first_construction_start<1974 // we only included counties that started construction in 1974 to calculate synthetic control so we can have enough pretreatment period (at least 5 years)
***drop counties whose status is future i.e didnt start construction yet
drop if GEOFIPS==6019
drop if GEOFIPS==16019
drop if GEOFIPS==16075
drop if GEOFIPS==47105
drop if GEOFIPS==49015
**drop counties that couldn't produce a synthetic control
drop if GEOFIPS==22125
drop if GEOFIPS==28021
***drop counties that built their first plant after 1978
drop if GEOFIPS==12075

*label variables
label var percentage_white "% of white (1969-1973)"
label var percentage_age65plus "% of 65 and older (1969-1973)"
label var nonwhite1950 "% of Non-White (1950)"
label var nonwhite1960 "% of Non-White (1960)"
label var nonwhite1970 "% of Non-White (1970)"
label var urban1950 "% of Urban (1950)"
label var urban1960 "% of Urban (1960)"
label var urban1970 "% of Urban (1970)"
label var foreign1950 "% of Foreign Born (1950)"
label var foreign1960 "% of Foreign Born (1960)"
label var HS1950 "Schooling: % of Pop. 25+ with completed HS (1950)"
label var coll4yr1950 "Schooling: % of Pop. 25+ with 4 years of college (1950)"
label var sch121960 "Schooling: % of Pop. 25+ with 12+ years of schooling(1960)"
label var sch121970 "Schooling: % of Pop. 25+ with 12+ years of schooling(1970)"
label var coll4yr1970 "Schooling: % of Pop. 25+ with 4+ years of schooling(1970)"
label var med_rent1950 "Log of Median Rent (1950)"
label var med_rent1960 "Log of Median Rent (1960)"
label var med_rent1970 "Log of Median Rent (1970)"
label var owner_occ1950 "% Dwellings Owner Occ. (1950)"
label var owner_occ1960 "% Dwellings Owner Occ. (1960)"
label var owner_occ1970 "% Dwellings Owner Occ. (1970)"
label var inc_21950 "Income less than $2000 (1950)"
label var inc_31960 "Income less than $3000 (1960)"
label var inc_31970 "Income less than $3000 (1970)"
label var lowinc1970 "% of Low Income families (1970)"
label var LF1950 "% in LF (1950)"
label var LF1960 "% in LF (1960)"
label var agri1950 "% of LF in Agriculture (1950)"
label var agri1960 "% of LF in Agriculture (1960)"
label var unemp1950 "% Unemployed (1950)"
label var unemp1960 "% Unemployed (1960)"
label var unemp1970 "% Unemployed (1970)"


*Treated vs Control
local y "percentage_white percentage_age65plus"
eststo treated: estpost sum `y' if year<=1973 & treated==1
eststo control: estpost sum `y' if year<=1973 & treated==0
eststo rest: estpost sum `y' if year<=1973 & restUS==1
esttab treated control rest using "${path}results/tableB2.csv", ///
    cells("mean(fmt(3))") ///
    mtitles("Treated" "Control" "Rest of the US") label replace

local y "nonwhite1950 nonwhite1960 nonwhite1970 urban1950 urban1960 urban1970 foreign1950 foreign1960 HS1950 coll4yr1950 sch121960 sch121970 coll4yr1970 med_rent1950 med_rent1960 med_rent1970 owner_occ1950 owner_occ1960 owner_occ1970  inc_21950 inc_31960 inc_31970 lowinc1970 LF1950 LF1960 agri1950 agri1960 unemp1950 unemp1960 unemp1970"
eststo treated: estpost sum `y' if year==1973 & treated==1
eststo control: estpost sum `y' if year==1973 & treated==0
eststo rest: estpost sum `y' if year==1973 & restUS==1
esttab treated control rest using "${path}results/tableB2.csv", ///
    cells("mean(fmt(3))") ///
    mtitles("Treated" "Control" "Rest of the US") label append
*stars in tableB2.csv come from the ttest below

*differences between treated and control: stars in column 2
local y "percentage_white percentage_age65plus"
eststo treated: estpost sum `y' if year<=1973 & treated==1
eststo control: estpost sum `y' if year<=1973 & treated==0
eststo diff: estpost ttest `y' if year<=1973, by(treated) unequal
esttab diff 
local y "nonwhite1950 nonwhite1960 nonwhite1970 urban1950 urban1960 urban1970 foreign1950 foreign1960 HS1950 coll4yr1950 sch121960 sch121970 coll4yr1970 med_rent1950 med_rent1960 med_rent1970 owner_occ1950 owner_occ1960 owner_occ1970  inc_21950 inc_31960 inc_31970 lowinc1970 LF1950 LF1960 agri1950 agri1960 unemp1950 unemp1960 unemp1970"
eststo treated: estpost sum `y' if year==1973 & treated==1
eststo control: estpost sum `y' if year==1973 & treated==0
eststo diff: estpost ttest `y' if year==1973, by(treated) unequal
esttab diff 

*differences between Treated vs Rest of US: stars in column 3
local y "percentage_white percentage_age65plus"
eststo treated: estpost sum `y' if year<=1973 & restUS==0 
eststo rest: estpost sum `y' if year<=1973 & restUS==1
eststo diff: estpost ttest `y' if year<=1973, by(restUS) unequal
esttab diff  
local y "percentage_white percentage_age65plus nonwhite1950 nonwhite1960 nonwhite1970 urban1950 urban1960 urban1970 foreign1950 foreign1960 HS1950 coll4yr1950 sch121960 sch121970 coll4yr1970 med_rent1950 med_rent1960 med_rent1970 owner_occ1950 owner_occ1960 owner_occ1970  inc_21950 inc_31960 inc_31970 lowinc1970 LF1950 LF1960 agri1950 agri1960 unemp1950 unemp1960 unemp1970"
eststo treated: estpost sum `y' if year==1973 & restUS==0 
eststo rest: estpost sum `y' if year==1973 & restUS==1
eststo diff: estpost ttest `y' if year==1973, by(restUS) unequal
esttab diff  

*Treated vs SC
use "${path}clean_data/Final SC panel (Emp).dta", clear
label var scm_percentage_white "% of white (1969-1973)"
label var scm_percentage_age65plus "% of 65 and older (1969-1973)"
label var scm_nonwhite1950 "% of Non-White (1950)"
label var scm_nonwhite1960 "% of Non-White (1960)"
label var scm_nonwhite1970 "% of Non-White (1970)"
label var scm_urban1950 "% of Urban (1950)"
label var scm_urban1960 "% of Urban (1960)"
label var scm_urban1970 "% of Urban (1970)"
label var scm_foreign1950 "% of Foreign Born (1950)"
label var scm_foreign1960 "% of Foreign Born (1960)"
label var scm_HS1950 "Schooling: % of Pop. 25+ with completed HS (1950)"
label var scm_coll4yr1950 "Schooling: % of Pop. 25+ with 4 years of college (1950)"
label var scm_sch121960 "Schooling: % of Pop. 25+ with 12+ years of schooling(1960)"
label var scm_sch121970 "Schooling: % of Pop. 25+ with 12+ years of schooling(1970)"
label var scm_coll4yr1970 "Schooling: % of Pop. 25+ with 4+ years of schooling(1970)"
label var scm_med_rent1950 "Log of Median Rent (1950)"
label var scm_med_rent1960 "Log of Median Rent (1960)"
label var scm_med_rent1970 "Log of Median Rent (1970)"
label var scm_owner_occ1950 "% Dwellings Owner Occ. (1950)"
label var scm_owner_occ1960 "% Dwellings Owner Occ. (1960)"
label var scm_owner_occ1970 "% Dwellings Owner Occ. (1970)"
label var scm_inc_21950 "Income less than $2000 (1950)"
label var scm_inc_31960 "Income less than $3000 (1960)"
label var scm_inc_31970 "Income less than $3000 (1970)"
label var scm_lowinc1970 "% of Low Income families (1970)"
label var scm_LF1950 "% in LF (1950)"
label var scm_LF1960 "% in LF (1960)"
label var scm_agri1950 "% of LF in Agriculture (1950)"
label var scm_agri1960 "% of LF in Agriculture (1960)"
label var scm_unemp1950 "% Unemployed (1950)"
label var scm_unemp1960 "% Unemployed (1960)"
label var scm_unemp1970 "% Unemployed (1970)"
local y "scm_percentage_white scm_percentage_age65plus"
eststo control: estpost sum `y' if year<=1973 & matched_treated==0
esttab control using "${path}results/tableB2.csv", ///
    cells("mean(fmt(3))") ///
    mtitles("Synthetic Control") label append

local y "scm_nonwhite1950 scm_nonwhite1960 scm_nonwhite1970 scm_urban1950 scm_urban1960 scm_urban1970 scm_foreign1950 scm_foreign1960 scm_HS1950 scm_coll4yr1950 scm_sch121960 scm_sch121970 scm_coll4yr1970 scm_med_rent1950 scm_med_rent1960 scm_med_rent1970 scm_owner_occ1950 scm_owner_occ1960 scm_owner_occ1970  scm_inc_21950 scm_inc_31960 scm_inc_31970 scm_lowinc1970 scm_LF1950 scm_LF1960 scm_agri1950 scm_agri1960 scm_unemp1950 scm_unemp1960 scm_unemp1970"
eststo control: estpost sum `y' if year==1973 & matched_treated==0
esttab control using "${path}results/tableB2.csv", ///
    cells("mean(fmt(3))") ///
    mtitles("Synthetic Control") label append
*column 4 is shown under column 1 in the excel sheet of tableB2.csv
*stars in table B2 come from the ttest below

*differences between treated and SC: stars in column 4
local y "scm_percentage_white scm_percentage_age65plus "
eststo treated: estpost sum `y' if year<=1973 & matched_treated==1
eststo control: estpost sum `y' if year<=1973 & matched_treated==0
eststo diff: estpost ttest `y' if year<=1973, by(matched_treated) unequal
esttab diff 
local y "scm_percentage_white scm_percentage_age65plus scm_nonwhite1950 scm_nonwhite1960 scm_nonwhite1970 scm_urban1950 scm_urban1960 scm_urban1970 scm_foreign1950 scm_foreign1960 scm_HS1950 scm_coll4yr1950 scm_sch121960 scm_sch121970 scm_coll4yr1970 scm_med_rent1950 scm_med_rent1960 scm_med_rent1970 scm_owner_occ1950 scm_owner_occ1960 scm_owner_occ1970  scm_inc_21950 scm_inc_31960 scm_inc_31970 scm_lowinc1970 scm_LF1950 scm_LF1960 scm_agri1950 scm_agri1960 scm_unemp1950 scm_unemp1960 scm_unemp1970"
eststo treated: estpost sum `y' if year==1973 & matched_treated==1
eststo control: estpost sum `y' if year==1973 & matched_treated==0
eststo diff: estpost ttest `y' if year==1973, by(matched_treated) unequal
esttab diff 

****Appendix Table B3 is manually produced using the weights of the Synthetic controls produced by the code below, the final weights are saved in clean data Synthetic Control Folder
****note that the code in the do file could take several hours to run
*do "${path}/do_files\SC weights builder.do"

*****Appendix Table B4
use "${path}clean_data/Final SC panel (Emp).dta", clear
eststo clear
eststo: areg scm_emp_rate  construction_dummy  commercial_dummy  i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)

use "${path}clean_data/Final SC panel (Wages).dta", clear
label variable construction_dummy "Construction"
label variable commercial_dummy "Commercial Operation"
label variable scm_emp_rate "Emp.to Pop. Ratio"
label variable scm_log_wages_Rpercapita "Log of  Per Capita Wages & Salaries"
label variable scm_wages_Rpercapita "Per Capita Wages & Salaries"
eststo: areg scm_log_wages_Rpercapita construction_dummy commercial_dummy i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
eststo: areg scm_wages_Rpercapita construction_dummy commercial_dummy i.year, a(matched_groups) vce(bootstrap) cluster(matched_groups)
esttab using "${path}results/tableB4.csv", b(%9.3f) se(%9.3f) star(* 0.1 ** 0.05 *** 0.01) nogaps label append ///
keep(construction_dummy commercial_dummy)
*********************************************************************************************************************************




